package com.mach.platform.sprider.dev;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.logging.SocketHandler;

public class TestGate {

    public static void main(String[] args) throws IOException {
        String ip = "";// 串口ip地址
        int port = 30000; //tcp端口,一般代表某条总线
        Socket sk = new Socket(ip, port);


        byte busId = 1; //目标地址
        byte cmdId = 05;//指令号


        byte[] getWellStatus = {busId,0x03,0x00,0x00,0x00,0x02,(byte)0xC4,0x0B}; //查询井盖状态

        byte[] openWell = {busId,0x05,0x00,0x00,(byte)0xFF,0x00,(byte)0x8C,0x3A}; //查询井盖状态
        byte[] closeWell = {busId,05,0x00,0x00,0x00,0x00,(byte)0xCD,(byte)0xCA}; //查询井盖状态


        OutputStream out = sk.getOutputStream();


        byte[] cmdBuf = getWellStatus ; //选择要发送的指令
        out.write(cmdBuf);

        out.flush();

        InputStream in = sk.getInputStream();

        byte[] readBuf = new byte[100];
        in.read(readBuf);

        UU.printData(readBuf);

    }
}
